package retail.loader;

import com.mysql.jdbc.StringUtils;


public class Config {
	
	private String schema; 
	private String oracleUsr;
	private String shardingFeild;
	public String getShardingFeild() {
		return shardingFeild;
	}

	public void setShardingFeild(String shardingFeild) {
		this.shardingFeild = shardingFeild;
	}
	private int maxPageSize = 200000;
<<<<<<< HEAD
	public static int currency = 5;
=======
	public static int currency = 1;
>>>>>>> 1ce2a0af3d001f8d009b9ae2a3a38d3be863296c
	
	
	
	public int getMaxPageSize() {
		return maxPageSize;
	}

	public void setMaxPageSize(int maxPageSize) {
		this.maxPageSize = maxPageSize;
	}

	public int getMinPageSize() {
		return minPageSize;
	}

	public void setMinPageSize(int minPageSize) {
		this.minPageSize = minPageSize;
	}
	private int minPageSize = 100000;
	
	
	public String getOracleUsr() {
		return oracleUsr;
	}

	public void setOracleUsr(String oracleUsr) {
		this.oracleUsr = oracleUsr;
	}
	private String tables;
 
	private String hugeTables;
	
	public String getHugeTables() {
		return hugeTables;
	}

	public void setHugeTables(String hugeTables) {
		this.hugeTables = hugeTables;
	}
	
	
	public String getTables() {
		return tables;
	}

	public void setTables(String val) {
		this.tables = val;
	}
  
	public String getSchema() {
		return schema;
	}

	public void setSchema(String schema) {
		this.schema = schema;
	}
	
	public static Config current;
	public Config(){
		current = this;
	}
	
	public boolean isHugeTable(String table){
		if( _tables == null )
		{
			if( hugeTables != null )
				_tables = hugeTables.split(",");
			else
				_tables = new String[]{}; 
		}
		for (String t : _tables) {
			if( t.equalsIgnoreCase(table))
				return true;
		}
		return false;
	}
	
	String[] _tables;
	public int getPageSize(String table){
		if( _tables == null )
		{
			if(!StringUtils.isEmptyOrWhitespaceOnly(hugeTables))
				_tables = hugeTables.split(",");
			else
				_tables = new String[]{}; 
		}
		for (String t : _tables) {
			if( t.equalsIgnoreCase(table))
				return  minPageSize;
		}
		return  maxPageSize;
	}
	
	public static boolean delete = false;
}
